<?php $this->load->view('admin/_begin') ?>
<?php $this->load->view('admin/' . $this->router->fetch_class() . '/_filter') ?>
<form accept-charset="utf-8" method="post" action="<?php echo site_url('admin/'.$this->router->fetch_class() . '/action') ?>">	
  <div id="filter-stage" style="display: block;">	
    <table border="0" class="table-list">
      <thead>
        <tr>
          <th class="align-center" with="30">
            <input type="checkbox" class="check-all" value="" name="action_to_all">
          </th>
          <th><?php echo $this->lang->line("label.promotion.title") ?></th>
          <th><?php echo $this->lang->line("label.promotion.code") ?></th>
          <th><?php echo $this->lang->line("label.promotion.start_date") ?></th>
          <th><?php echo $this->lang->line("label.promotion.end_date") ?></th>
          <th><?php echo $this->lang->line("label.promotion.status") ?></th>
          <th><?php echo $this->lang->line("label.promotion.rate_point") ?></th>          
          <th></th>
        </tr>
      </thead>
      <tbody>
        <?php
        $status = array(
            PROMOTION_NEW => $this->lang->line('label.promotion.status.new'),
            PROMOTION_PEDDING => $this->lang->line('label.promotion.status.pedding'),
            PROMOTION_APPROVED => $this->lang->line('label.promotion.status.approve'),
            PROMOTION_PUBLISH => $this->lang->line('label.promotion.status.publish'),
            PROMOTION_REJECT => $this->lang->line('label.promotion.status.reject'),
            PROMOTION_BLOCK => $this->lang->line('label.promotion.status.block'));
        foreach ($objects as $obj) {
          ?>
          <tr>
            <td class="align-center">
              <input type="checkbox" value="<?php echo $obj['id'] ?>" name="action_to[]">
            </td>
            <td>
              <a href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/show/' . $obj['id']) ?>">
                <?php echo $obj["title"] ?>
              </a>
            </td>
            <td>
              <?php echo $obj["code"] ?>
            </td>
            <td>
              <?php echo empty($obj["start_date"]) ? '' : date($this->setting_model->item('date_format'), $obj["start_date"]) ?>
            </td>
            <td>
              <?php echo empty($obj["end_date"]) ? '' : date($this->setting_model->item('date_format'), $obj["end_date"]) ?>
            </td><td>
              <?php echo @$status[$obj["status"]] ?>
            </td><td>
              <?php echo $obj["rate_point"] ?>
            </td>            
            <td class="actions">
              <a class="btn orange edit" href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/edit/' . $obj['id']) ?>">
                <?php echo $this->lang->line('btn.edit') ?>
              </a>
              <a class="confirm btn red delete" href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/delete/' . $obj['id']) ?>"
                 style="margin-left: 5px">
                <?php echo $this->lang->line('btn.delete') ?></a>					
            </td>
          </tr>
        <?php } ?>
      </tbody>
    </table><div class="paging"><?php echo $paging ?></div>
  </div>  
  <div class="table_action_buttons">
    <button class="btn blue confirm" value="approve" name="btnAction" type="submit" disabled="disabled">
      <span><?php echo $this->lang->line('btn.approve') ?></span>
    </button>
    <button class="btn green confirm" value="publish" name="btnAction" type="submit" disabled="disabled">
      <span><?php echo $this->lang->line('btn.publish') ?></span>
    </button>
    <button class="btn orange confirm" value="reject" name="btnAction" type="submit" disabled="disabled">
      <span><?php echo $this->lang->line('btn.reject') ?></span>
    </button>
    <button class="btn gray confirm" value="block" name="btnAction" type="submit" disabled="disabled">
      <span><?php echo $this->lang->line('btn.block') ?></span>
    </button>
    <button class="btn red confirm" value="delete" name="btnAction" type="submit" disabled="disabled">
      <span><?php echo $this->lang->line('btn.delete') ?></span>
    </button>
  </div>
</form>
<?php $this->load->view('admin/_end') ?>